UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NnGA11Ixp545WU2pTYA9ghE5iu9HR/IWL1lcnr1t5fU='
WHERE
key_id = 'a977ea11f052904c72c7fd8449689e7dd7b8f56d57de893e625ef1ade1d98d24'
AND (
token = 'NnGA11Ixp545WU2pTYA9ghE5iu9HR/IWL1lcnr1t5fU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)