UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WXa9vtkKKw+ynx568gRgXqbCKMDLNmc0o6lLXa5v5Hs=' 
WHERE 
  key_id = 'df2bda656899c7a6829de361d157a92c49457c4b74d2da9b5aa1ac5d17431360' 
  AND (
    token = 'WXa9vtkKKw+ynx568gRgXqbCKMDLNmc0o6lLXa5v5Hs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051