UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OxwYVfOB6e6IuILAp6jtIm9lNQvBg21G04zqQED66Q8='
WHERE
key_id = 'efdf0f6354b2582907af2a910a0b6afc2eeec11b40fa092b57e0be9c0bb36abd'
AND (
token = 'OxwYVfOB6e6IuILAp6jtIm9lNQvBg21G04zqQED66Q8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)