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