UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0Ah3PIVk2Y3fQq93PvSwenbDy+FasepvpJnUyOqw4g=' 
WHERE 
  key_id = 'b4742a144bc4c89a69dd219030803477eef428730866681b71014548440ea5ba' 
  AND (
    token = 'O0Ah3PIVk2Y3fQq93PvSwenbDy+FasepvpJnUyOqw4g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032