UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JP8AvccWxDyf7pkVM03nAph0WDOBkuvRXcD0+jKUCEw='
WHERE
key_id = 'f563b0210bb06e42b55768ab930cffb0d06b66e6eb590651df86167cc72ff19c'
AND (
token = 'JP8AvccWxDyf7pkVM03nAph0WDOBkuvRXcD0+jKUCEw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)