UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kYbOtOcNCfOLnVbMIRQsXFv5+tAEEBsZmZ2CaZi+44M=' 
WHERE 
  key_id = '4aa05be5a889736b1ba613eb5686b14a1e512e41afb2e4eae21332996e9bc1a4' 
  AND (
    token = 'kYbOtOcNCfOLnVbMIRQsXFv5+tAEEBsZmZ2CaZi+44M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021