UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qQQIMGa6jr2lL0ude8SvEXESAroBN+NHOtTTt1iujr8='
WHERE
key_id = 'd92906518150b1cc3a1fe2355706096ebf608aeacb5bc3aa2cddc4417b9e268a'
AND (
token = 'qQQIMGa6jr2lL0ude8SvEXESAroBN+NHOtTTt1iujr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)