UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hb7gHpzMonmgYjfS2Bbw2ipyydIIIMGk8FaQaG/KUDY=' 
WHERE 
  key_id = 'dfb149c2943f24cb0f81e6820767f4d2115824af97d1aa5934602e07697fa3f1' 
  AND (
    token = 'Hb7gHpzMonmgYjfS2Bbw2ipyydIIIMGk8FaQaG/KUDY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041