UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pXVL5G035IrCh1L0U7w6LPhf5GTyzlQFPWJ9St2dvgQ=' 
WHERE 
  key_id = '16a23a27929188b10c97ed8ede2cab3391299652d08e5b3c47f1953992da630e' 
  AND (
    token = 'pXVL5G035IrCh1L0U7w6LPhf5GTyzlQFPWJ9St2dvgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029