UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6KhsFtaa/4rHVnIJWOo2pVfQwHtvlFut8Z+clyFkjj8='
WHERE
key_id = '8d018caf11bb06231188d7314db147970cf24912e3bed783feda9e777363b3da'
AND (
token = '6KhsFtaa/4rHVnIJWOo2pVfQwHtvlFut8Z+clyFkjj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)