UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fkikl2Ti3+ln7yWAdNd3W3qT6pjAvSIg6gFeeDyqFKM=' 
WHERE 
  key_id = '30b376934d20443dabc574818d74264dec35b105612b840223edd86626748356' 
  AND (
    token = 'Fkikl2Ti3+ln7yWAdNd3W3qT6pjAvSIg6gFeeDyqFKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059