UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n2CVdC7evpJTIiq/ika5vRXB7Xa+osNDoaUDPV4E1R8='
WHERE
key_id = '18aed46877f2ec0620033d390c5c1a0d99c37da67efa38b7ee43a2de31155248'
AND (
token = 'n2CVdC7evpJTIiq/ika5vRXB7Xa+osNDoaUDPV4E1R8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)