UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wqNC9O6nWC1+h25dHqq0Of6yQzYAskZYrC54SN5Mb+4='
WHERE
key_id = 'ddf2676ce19149bf794916b4d5f146dbde227606e3fb5333224f43d7118f9f38'
AND (
token = 'wqNC9O6nWC1+h25dHqq0Of6yQzYAskZYrC54SN5Mb+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)