UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'snA7NG08SlwhPDpTWETp0aiDuUxcyi2oO0L64aVCv3Q='
WHERE
key_id = '276e8bdef237884feca6c5db5097be07815980d5fb5ed66c2659a29d2f8f5503'
AND (
token = 'snA7NG08SlwhPDpTWETp0aiDuUxcyi2oO0L64aVCv3Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)