UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'paGmTLOGgU4eY6y0cX1ak84uGjLXTqcN+WAdfc0brKk=' 
WHERE 
  key_id = 'fe3cd67cbf22227dafca11f3944cfe61c3c7ea2e316350fbc053bbd4c51cf285' 
  AND (
    token = 'paGmTLOGgU4eY6y0cX1ak84uGjLXTqcN+WAdfc0brKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032