UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Rgyti4zdR4nlHp8T6CWFUlxAjdd2oCpoPfLQ0I81qO4='
WHERE
key_id = 'ea2dd0c36633d76d5b904a369b2b496aba641049889b292d4a8b5d1c18c27a90'
AND (
token = 'Rgyti4zdR4nlHp8T6CWFUlxAjdd2oCpoPfLQ0I81qO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)