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