UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qaR7GcPIGntoWbGqpqhNYHNYabmtAQlC6x79TexrmX8='
WHERE
key_id = '60c336ecaa4895944d380fbbc63f1b81472a49e5b014fb9e4596d23def7a3402'
AND (
token = 'qaR7GcPIGntoWbGqpqhNYHNYabmtAQlC6x79TexrmX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)