UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S5hPTVTAuLJy7cnmLKmdEwhdJeB1+twJm+SinNCt3MY='
WHERE
key_id = 'f6dfb266f9e8002f4f98d9e38cabdf07ca4e1cb4c81b08dfb23d996a135ae1da'
AND (
token = 'S5hPTVTAuLJy7cnmLKmdEwhdJeB1+twJm+SinNCt3MY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)