UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nrZp7KhwXjqvLGXJKzoLiSr+b4BD0IMi+vSGImLMDHQ='
WHERE
key_id = '304360abc35ad589a5e7a30c62555436fdee767a680b7897117ade938e867d30'
AND (
token = 'nrZp7KhwXjqvLGXJKzoLiSr+b4BD0IMi+vSGImLMDHQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)