UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't4niAMJURXof/PY8B7ib3fZKdi13GKL9gaEp4fm0C5U='
WHERE
key_id = 'caaec54a40d8358a682dddac159595e65a39b6a2182044ecba78f8aaec711463'
AND (
token = 't4niAMJURXof/PY8B7ib3fZKdi13GKL9gaEp4fm0C5U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)