UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JH2d4uNG3QRB93Onp50cbQqaAlMozTzZ4ewK7MDeRXw='
WHERE
key_id = '508754c7d5123da6c05034fa51a2df157b133c08d7cb6ff9694f3937b3c2730a'
AND (
token = 'JH2d4uNG3QRB93Onp50cbQqaAlMozTzZ4ewK7MDeRXw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)