UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0jSbUsoMMH7XVcggJ1TnIJ0vqftGLXYwvEMYeAzZghs='
WHERE
key_id = '6c4c9d45abb2e4dc435d673b2417fa514c485352293c0e4c7e392d15e660a790'
AND (
token = '0jSbUsoMMH7XVcggJ1TnIJ0vqftGLXYwvEMYeAzZghs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)