UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9TcFocysCJS8b2juHPNfiBE4l34/+NVm7EHjARNYabs='
WHERE
key_id = '3c2df0552093f8c0850187bf41e21ffeeacab385e4fff3aac839239975da8ac7'
AND (
token = '9TcFocysCJS8b2juHPNfiBE4l34/+NVm7EHjARNYabs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)