UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HERgAaliZuPAQFbmUK/aPmhojIA5WPHFnBjuvIO+7Wk='
WHERE
key_id = 'eb63df4aea9937f551c44083b28acf8c8d4a563c95f674e068d652806f831e3a'
AND (
token = 'HERgAaliZuPAQFbmUK/aPmhojIA5WPHFnBjuvIO+7Wk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)