UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5annrFVLLLEQO1F58gpaSOSK9z1zT6ZUOJ+HwO4p27w=' 
WHERE 
  key_id = '03fb00231fbb5e4883b81a4ffcbde1ce4665b69843c284f559a60f44f11d12b5' 
  AND (
    token = '5annrFVLLLEQO1F58gpaSOSK9z1zT6ZUOJ+HwO4p27w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037