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