UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ia3DWD8tBlncSMZqIVAfkxjzmEimpYDhxuj2V123dtk='
WHERE
key_id = '740aeef14de57abea0e56fadf55a718ff2b14c08eda08c928b8de8068d2c7407'
AND (
token = 'ia3DWD8tBlncSMZqIVAfkxjzmEimpYDhxuj2V123dtk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)