UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'swSxS2GU3D1FyAUc8TeHzh4ZwzJludYmZRvfveEUp8U=' 
WHERE 
  key_id = 'ec8e3345dddd419d2a80a9695e8ad739fea34d5deb7246dfd332b776cf34a7ed' 
  AND (
    token = 'swSxS2GU3D1FyAUc8TeHzh4ZwzJludYmZRvfveEUp8U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034