UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'faWYxmIT4Ai63/o3z5F6/4lQt2uuBvaIkh6gOZmB8Aw=' 
WHERE 
  key_id = '9f4324ebde60c1026318f40aab7123e0ef2588ee01ad6609f3ba2d3038edaa60' 
  AND (
    token = 'faWYxmIT4Ai63/o3z5F6/4lQt2uuBvaIkh6gOZmB8Aw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020