UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+8HaogVnjkCQHMTTghdgcLEJM8P5ntBULnXShP5oafU='
WHERE
key_id = '48bcba9217bd6fcf297a09c197611809509e18bee84c0da1e5828429ec90d293'
AND (
token = '+8HaogVnjkCQHMTTghdgcLEJM8P5ntBULnXShP5oafU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)