UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5GNCZAJyAbsuwoRmMT1Tn6TvCoHpyLyyyQgFDUWIxOA=' 
WHERE 
  key_id = 'a8729588456ec47024da4b78bad353dee4246ff8626b1d5385336221111da2a2' 
  AND (
    token = '5GNCZAJyAbsuwoRmMT1Tn6TvCoHpyLyyyQgFDUWIxOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041